//
//  ZBCollectionViewCell.m
//  testdemo
//
//  Created by zhoubo on 17/3/15.
//  Copyright © 2017年 zhoubo. All rights reserved.
//

#import "ZBCollectionViewCell.h"
#import "UIImageView+WebCache.h"
#import <Masonry.h>

@interface ZBCollectionViewCell ()
@property (nonatomic,strong) UILabel* titlelbl;
@end


@implementation ZBCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.iconView = [[UIImageView alloc]init];
        self.iconView.frame = self.frame;
        
        [self.contentView addSubview:self.iconView];
        
        self.titlelbl = [[UILabel alloc]init];
        self.titlelbl.font = [UIFont systemFontOfSize:11];
        self.titlelbl.textColor = [UIColor blackColor];
        [self.contentView addSubview:self.titlelbl];
        self.contentView.backgroundColor = [UIColor whiteColor];
        
    }
    return self;
}


-(void)layoutSubviews
{
    [super layoutSubviews];
    self.iconView.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height-25);
    [self.titlelbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.contentView);
        make.bottom.equalTo(self.contentView).offset(-5);
        
    }];
    [self.titlelbl sizeToFit];

    
}

-(void)setModel:(LoopModel *)model
{
    _model = model;
    

    NSString* str = model.image;

        
    [self.iconView sd_setImageWithURL:[NSURL URLWithString:model.image] placeholderImage:[UIImage imageNamed:@"placeholder.jpg"]];
    self.titlelbl.text = model.title;
    

    
}

@end
